package com.gmail.dmitryustimov.ms.java7.observer.classic.demo.subj1subsc1event1;

import java.math.BigDecimal;

public class Subscriber implements Observer {

    private String name;
    private Subject subject;
    private BigDecimal sum = BigDecimal.valueOf(0);

    public Subscriber(Subject subject, String name) {
        this.name = name;
        this.subject = subject;
        subject.registerObserver(this);
    }

    @Override
    public void update(Event event) {
        sum.add(BigDecimal.valueOf(1));
    }
}
